package com.thd.framework.db.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

/**
 * com.thd.springboot.framework.db.entity.BaseEntity
 *
 * @author: wanglei62
 * @DATE: 2020/1/21 17:51
 **/
@JsonInclude(JsonInclude.Include.ALWAYS)
public class BasicEntity extends MyPage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 租户id
     */
    @ApiModelProperty("租户id")
    @JsonIgnore
    @TableField(value="tenant_id",fill = FieldFill.INSERT)
    private String tenantId;
    /**
     * 是否已删除
     */
    @ApiModelProperty("是否已删除")
    @JsonIgnore
    @TableField("is_deleted")
    @TableLogic(value="0",delval = "1")
    private Integer isDeleted = 0;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @TableField(value="create_time",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    @TableField(value="modify_time",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date modifyTime;

    /**
     * 创建人
     */
    @ApiModelProperty("创建人")
    @TableField(value="create_by",fill = FieldFill.INSERT)
    private String createBy;

    /**
     * 修改人
     */
    @ApiModelProperty("修改人")
    @TableField(value="modify_by",fill = FieldFill.INSERT_UPDATE)
    private String modifyBy;


    @ApiModelProperty("创建时间-从")
    @TableField(exist = false)
    private String createTimeFrom;
    @ApiModelProperty("创建时间-至")
    @TableField(exist = false)
    private String createTimeTo;
    @ApiModelProperty("修改时间-从")
    @TableField(exist = false)
    private String modifyTimeFrom;
    @ApiModelProperty("修改时间-至")
    @TableField(exist = false)
    private String modifyTimeTo;



   public Integer getIsDeleted() {
      return isDeleted;
   }

   public void setIsDeleted(Integer isDeleted) {
      this.isDeleted = isDeleted;
   }

   public Date getCreateTime() {
      return createTime;
   }

   public void setCreateTime(Date createTime) {
      this.createTime = createTime;
   }

   public Date getModifyTime() {
      return modifyTime;
   }

   public void setModifyTime(Date modifyTime) {
      this.modifyTime = modifyTime;
   }

   public String getCreateBy() {
      return createBy;
   }

   public void setCreateBy(String createBy) {
      this.createBy = createBy;
   }

   public String getModifyBy() {
      return modifyBy;
   }

   public void setModifyBy(String modifyBy) {
      this.modifyBy = modifyBy;
   }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getCreateTimeFrom() {
        if(null != createTimeFrom && createTimeFrom.length() > 0){
            return createTimeFrom +  " 00:00:00";
        }
        return createTimeFrom;
    }
    public String getCreateTimeTo() {
        if(null != createTimeTo && createTimeTo.length() > 0){
            return createTimeTo +  " 23:59:59";
        }
        return createTimeTo;
    }
    public String getModifyTimeFrom() {
        if(null != modifyTimeFrom && modifyTimeFrom.length() > 0){
            return modifyTimeFrom +  " 00:00:00";
        }
        return modifyTimeFrom;
    }
    public String getModifyTimeTo() {
        if(null != modifyTimeTo && modifyTimeTo.length() > 0){
            return modifyTimeTo +  " 23:59:59";
        }
        return modifyTimeTo;
    }


    public void setCreateTimeFrom(String createTimeFrom) {
        this.createTimeFrom = createTimeFrom;
    }



    public void setCreateTimeTo(String createTimeTo) {
        this.createTimeTo = createTimeTo;
    }



    public void setModifyTimeFrom(String modifyTimeFrom) {
        this.modifyTimeFrom = modifyTimeFrom;
    }



    public void setModifyTimeTo(String modifyTimeTo) {
        this.modifyTimeTo = modifyTimeTo;
    }
}
